﻿using System.Data.Entity;
using System.Collections.Generic;
using System.Linq;


namespace Enterprise.Infrastructure.RepositoryFramework
{
    public class Repositorio : DbContext , IRepositorio
    {
        public void Salvar()
        {
            SaveChanges();
        }

        public T Obter<T>(string procedure, params object[] parametros)
        {
            return base.Database.SqlQuery<T>(procedure, parametros).FirstOrDefault();
        }


        public IEnumerable<T> Listar<T>(string procedure, params object[] parametros)
        {
            return base.Database.SqlQuery<T>(procedure, parametros);
        }

        public void Executar(string procedure, params object[] parametros)
        {
            base.Database.ExecuteSqlCommand(procedure, parametros);
        }

    }
}
